#include"FileHandling.h"

FileHandling::FileHandling()
	:fileptr(nullptr)
{


}

FileHandling::~FileHandling()
{


}

void FileHandling::LoadLevel(string textname)
{
	const char*c =textname.c_str();
	
	fopen_s(&fileptr, c, "r");

	// if something went wrong, unload
	if (fileptr == nullptr)
	{
		printf("ERROR");
	}
		

				
	mWavenum=fgetc(fileptr);
	fscanf_s(fileptr, "%*s %d", &mEnemyNumberA); // %*s reads
	fscanf_s(fileptr, "%*s %d", &mEnemyNumberB); // %*s reads
	fscanf_s(fileptr, "%*s %d", &mEnemyNumberC); // %*s reads

	fscanf_s(fileptr, "%*s %d", &mBossTypeA);  // then discards
	fscanf_s(fileptr, "%*s %d", &mBossTypeB);
	fscanf_s(fileptr, "%*s %d", &mBossTypeC);


			


}



int FileHandling::GetBossNumber(char* bosstype)
{
	if(strcmp(bosstype,"BossTypeA")==0)
	{
		return mBossTypeA;
	}

	else if(strcmp(bosstype,"BossTypeB")==0)
	{
		return mBossTypeB;
	}

	else if(strcmp(bosstype,"BossTypeC")==0)
	{
		return mBossTypeC;
	}

	

}

int FileHandling::GetEnemyNumber(char* enemytype)
{
	if(strcmp(enemytype,"EnemyNumberA")==1)
	{
		return mEnemyNumberA;
	}

	else if(strcmp(enemytype,"EnemyNumberB")==0)
	{
		return mEnemyNumberB;
	}

	else if(strcmp(enemytype,"EnemyNumberC")==0)
	{
		return mEnemyNumberC;
	}
}